package com.test.testlogs.config;

import com.test.testlogs.fliter.LogFliter;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author ：wang qiang
 * @date ：Created 2024/7/31 15:50
 * @description：日志唯一ID配置
 */
@Configuration
public class LogTraceIdConfig implements WebMvcConfigurer {

    //@Bean
    public LogFliter logInterceptor() {
        return new LogFliter();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(logInterceptor())
        // 自定义需要拦截的和不需要拦截的
        .addPathPatterns("/**").excludePathPatterns("/login*****.html");
    }
}
